<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/7/13
 * Time: 22:13
 */

//include_once 'Config.php';

class Player
{
    private $PlayerId;
    private $PlayerName;
    private $PlayerHeaderImg;
    private $PlayerDetail;
    private $ReadyState;


    public function __construct($config)
    {
        $this->PlayerId         = $config['user_id'];
        $this->PlayerName       = $config['username'];
        $this->PlayerHeaderImg  = $config['head_img'];
        $this->PlayerDetail     = $config;
        $this->PlayerDetail     = 0;
    }

    /**
     * @return mixed
     */
    public function getPlayerDetail()
    {
        return $this->PlayerDetail;
    }

    /**
     * @return mixed
     */
    public function getPlayerId()
    {
        return $this->PlayerId;
    }

    /**
     * @param mixed $PlayerCredits
     */

    //游戏结束时结算
    public function outGame($num)
    {
        $this->PlayerCredits +=$num;//原有积分加结束时得到的积分
        $data=[
            'PlayerId'=>$this->PlayerId,
            'PlayerName'=> $this->PlayerName,
            'PlayerHeaderImg'=>$this->PlayerHeaderImg,
            'PlayerCredits'=>$this->PlayerCredits,
        ];
        return $data;

    }
}

